package cn.iocoder.yudao.module.happycore.config;

import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TomcatConfig {
    @Bean
    public WebServerFactoryCustomizer<TomcatServletWebServerFactory> tomcatCustomizer() {
        return factory -> factory.addConnectorCustomizers(connector -> {
            connector.setMaxPostSize(5000 * 1024 * 1024); // 5000MB
            // 强制解除文件数量限制（Tomcat 内部参数，需根据版本调整）
            connector.setMaxPartCount(700);
            connector.setMaxParameterCount(700);
        });
    }
}
